/*
 * Copyright [2013-2021], Alibaba Group Holding Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.alibaba.polardbx.qatest.ddl.auto.partition;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runners.Parameterized;

import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;

/**
 * @author chenghui.lch
 */
public class PartitionColumnTypeForKeyTest extends PartitionColumnTypeTestBase {

    public PartitionColumnTypeTestBase.TestParameter parameter;

    public PartitionColumnTypeForKeyTest(PartitionColumnTypeTestBase.TestParameter parameter) {
        super(parameter);
        this.testDbName = this.testDbName + "_k1";
    }

    @Parameterized.Parameters(name = "{index}: partColTypeTestCase {0}")
    public static List<PartitionColumnTypeTestBase.TestParameter> parameters() {
        // partition strategy: range/list/hash/range column/list column/key
        // data type: numeric/string/time
        return Arrays.asList(

            /**
             * ========= Key =========== 
             */
            /* varchar */
            new PartitionColumnTypeTestBase.TestParameter(
                "key_varchar",
                new String[] {"c1"}/*col*/,
                new String[] {"varchar(8) CHARACTER SET utf8 COLLATE utf8_general_ci default null "}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "('a')", "('b')", "(\'\')", "('世界')", "( x'E4B896E7958C' )", "('☺')", "('12345678')",
                    "(null)"}/*insertValues*/
                ,
                new String[] {
                    "('A')", "('B')", "('a')", "('b')", "('a  ')", "('b   ')", "(\'\')", "('世界')",
                    "( x'E4B896E7958C' )", "('☺')", "('12345678')", "(null)"}/*selectValues*/
                , new String[] {
                "('12345677')", "('12345679')", "('A')", "('B')", "('a')", "('a  ')", "('b')", "('b   ')", "('世界')",
                "('世界人民')"}/*rngSortValues*/
            )

            /* varchar */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_varchar32",
                new String[] {"c1"}/*col*/,
                new String[] {"varchar(32) CHARACTER SET utf8 COLLATE utf8_bin default null "}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "('a')", "('b')", "(\'\')", "('世界')", "( x'E4B896E7958C' )", "('☺')", "('12345678')",
                    "(null)"}/*insertValues*/,
                new String[] {
                    "('a')", "('b')", "(\'\')", "('世界')", "( x'E4B896E7958C' )", "('☺')", "('12345678')",
                    "(null)"}/*selectValues*/
                , new String[] {
                "('12345677')", "('12345679')", "('A')", "('B')", "('a')", "('a  ')", "('b')", "('b   ')", "('世界')",
                "('世界人民')"}/*rngSortValues*/
            )

            /* char */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_char",
                new String[] {"c1"}/*col*/,
                new String[] {"char(32) CHARACTER SET utf8 COLLATE utf8_general_ci default null "}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "('a')", "('b')", "(\'\')", "('世界')", "( x'E4B896E7958C' )", "('☺')", "('12345678')",
                    "(null)"}/*insertValues*/
                ,
                new String[] {
                    "('A')", "('B')", "('a')", "('b')", "('a  ')", "('b   ')", "(\'\')", "('世界')",
                    "( x'E4B896E7958C' )", "('☺')", "('12345678')", "(null)"}/*selectValues*/
                , new String[] {
                "('12345677')", "('12345679')", "('A')", "('B')", "('a')", "('a  ')", "('b')", "('b   ')", "('世界')",
                "('世界人民')"}/*rngSortValues*/
            )

            /* char */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_char32",
                new String[] {"c1"}/*col*/,
                new String[] {"char(32) CHARACTER SET utf8 COLLATE utf8_bin default null "}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "('a')", "('b')", "(\'\')", "('世界')", "( x'E4B896E7958C' )", "('☺')", "('12345678')",
                    "(null)"}/*insertValues*/,
                new String[] {
                    "('a')", "('b')", "(\'\')", "('世界')", "( x'E4B896E7958C' )", "('☺')", "('12345678')",
                    "(null)"}/*selectValues*/
                , new String[] {
                "('12345677')", "('12345679')", "('A')", "('B')", "('a')", "('a  ')", "('b')", "('b   ')", "('世界')",
                "('世界人民')"}/*rngSortValues*/
            )

            /* datetime */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_datetime",
                new String[] {"c1"}/*col*/,
                new String[] {"datetime default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "('2020-12-12 00:00:00')", "('2020-11-11 23:59:59.123')", "('2020-11-11 23:59:59.789')",
                    "('2020-12-11')", "('0000-00-00 00:00:00')", "('9999-99-99 99:99:99')", "('')"}/*insertValues*/,
                new String[] {
                    "(null)", "('2020-12-12 00:00:00')", "('2020-11-11 23:59:59')", "('2020-11-12 00:00:00')",
                    "('2020-12-11')", "('0000-00-00 00:00:00')"}/*selectValues*/
                , isMySQL80() ? new String[] {
                "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00')"} : new String[] {
                "('')", "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00')", "('9999-99-99 99:99:99')"}/*rngSortValues*/
            )

            /* datetime(6) */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_datetime6",
                new String[] {"c1"}/*col*/,
                new String[] {"datetime(6) default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "('2020-12-12 00:00:00.123456')", "('2020-11-11 23:59:59.789013')",
                    "('2020-11-11 23:59:59.789')", "('2020-12-11')", "('0000-00-00 00:00:00')",
                    "('9999-99-99 99:99:99')", "('')"}/*insertValues*/
                ,
                new String[] {
                    "(null)", "('2020-12-12 00:00:00.123456')", "('2020-11-11 23:59:59.789013')",
                    "('2020-11-11 23:59:59.789')", "('2020-12-11')", "('0000-00-00 00:00:00')"}/*selectValues*/
                , isMySQL80() ? new String[] {
                "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')"} : new String[] {
                "('')", "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')", "('9999-99-99 99:99:99')"}/*rngSortValues*/
            )

            /* date */
            // '1000-01-01' to '9999-12-31'
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_date",
                new String[] {"c1"}/*col*/,
                new String[] {"date default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "('2020-12-12')", "('2020-11-11')", "('2020-12-11')", "('1000-00-00')", "('1000-01-01')",
                    "('9999-12-31')",
                    "('9999-99-99')", "('9999-99-99 99:99:99')", "('')"}/*insertValues*/,
                isMySQL80() ? new String[] {
                    "(null)", "('2020-12-12')", "('2020-11-11')", "('2020-12-11')", "('1000-00-00')", "('1000-01-01')",
                    "('9999-12-31')",
                    "('0000-00-00 00:00:00')"} : new String[] {
                    "(null)", "('2020-12-12')", "('2020-11-11')", "('2020-12-11')", "('1000-00-00')", "('1000-01-01')",
                    "('9999-12-31')",
                    "('9999-99-99')", "('0000-00-00 00:00:00')"}/*selectValues*/
                , isMySQL80() ? new String[] {
                "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')"} : new String[] {
                "('')", "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')", "('9999-99-99 99:99:99')"}/*rngSortValues*/
            )

            /* timestamp */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_timestamp",
                new String[] {"c1"}/*col*/,
                new String[] {"timestamp default current_timestamp"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "('2020-12-12')", "('2020-11-11')", "('2020-12-11')", "('1000-01-01')", "('9999-12-31')",
                    "('9999-99-99 99:99:99')", "('')"}/*insertValues*/,
                new String[] {
                    "('2020-12-12')", "('2020-11-11')", "('2020-12-11')", "('1000-01-01')", "('9999-12-31')",
                    "('0000-00-00 00:00:00')"}/*selectValues*/
                , isMySQL80() ? new String[] {
                "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')"} : new String[] {
                "('')", "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')", "('9999-99-99 99:99:99')"}/*rngSortValues*/
            )

            /* timestamp(6) */
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_timestamp6",
                new String[] {"c1"}/*col*/,
                new String[] {"timestamp(6) default current_timestamp(6)"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "('2020-12-12 00:00:00.123456')", "('2020-11-11 23:59:59.789013')",
                    "('2020-11-11 23:59:59.789')", "('2020-12-11')", "('0000-00-00 00:00:00')",
                    "('9999-99-99 99:99:99')", "('')"}/*insertValues*/
                ,
                new String[] {
                    "('2020-12-12 00:00:00.123456')", "('2020-11-11 23:59:59.789013')",
                    "('2020-11-11 23:59:59.789')", "('2020-12-11')", "('0000-00-00 00:00:00')"}/*selectValues*/
                , isMySQL80() ? new String[] {
                "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')"} : new String[] {
                "('')", "('0000-00-00 00:00:00')", "('2020-11-11 23:59:58.123')", "('2020-11-11 23:59:59.789013')",
                "('2020-11-11 23:59:59.799')",
                "('2020-12-11 00:00:00')",
                "('2020-12-12 00:00:00.123456')", "('9999-99-99 99:99:99')"}/*rngSortValues*/
            )

            /* BIGINT */
            //# bigint: -9223372036854775808 to 9223372036854775807
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_bigint",
                new String[] {"c1"}/*col*/,
                new String[] {"bigint default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(0)", "(null)", "(-9223372036854775808)", "(9223372036854775807)", "(-9223372036854775807)",
                    "(922337203685477580)", "(922337203685477579)", "('-9223372036854775808')",
                    "('922337203685477580')", "('184467440737095516150')", "('-184467440737095516150')",
                    "('-184467440737095516150')",
                    "('-184467440737095516148')",
                    "('-9223372036854775813')",
                    "(-9223372036854775808)",
                    "(-9223372036854775803)",
                    "(-2147483653)",
                    "(-2147483648)",
                    "(-2147483643)",
                    "(-8388613)",
                    "(-8388608)",
                    "(-8388603)",
                    "(-32773)",
                    "(-32768)",
                    "(-32763)",
                    "(-133)",
                    "(-128)",
                    "(-123)",
                    "(-5)",
                    "(0)",
                    "(5)",
                    "(122)",
                    "(127)",
                    "(132)",
                    "(255)",
                    "(32762)",
                    "(32767)",
                    "(32772)",
                    "(65530)",
                    "(65535)",
                    "(65540)",
                    "(8388602)",
                    "(8388607)",
                    "(8388612)",
                    "(16777210)",
                    "(16777215)",
                    "(16777220)",
                    "(2147483642)",
                    "(2147483647)",
                    "(2147483652)",
                    "(4294967290)",
                    "(4294967295)",
                    "(4294967300)",
                    "(9223372036854775802)",
                    "(9223372036854775807)",
                    "(9223372036854775812)",
                    "(18446744073709551610)",
                    "(18446744073709551615)",
                    "('1844674407370955162')",
                    "('184467440737095516148')",
                    "('184467440737095516150')"
                }/*insertValues*/
                , new String[] {
                "(0)", "(null)", "(-9223372036854775808)", "(9223372036854775807)", "(-9223372036854775807)",
                "(922337203685477580)", "(922337203685477579)", "('-9223372036854775808')", "('922337203685477580')"
                ,
                "('-184467440737095516150')",
                "('-184467440737095516148')",
                "('-9223372036854775813')",
                "(-9223372036854775808)",
                "(-9223372036854775803)",
                "(-2147483653)",
                "(-2147483648)",
                "(-2147483643)",
                "(-8388613)",
                "(-8388608)",
                "(-8388603)",
                "(-32773)",
                "(-32768)",
                "(-32763)",
                "(-133)",
                "(-128)",
                "(-123)",
                "(-5)",
                "(0)",
                "(5)",
                "(122)",
                "(127)",
                "(132)",
                "(255)",
                "(32762)",
                "(32767)",
                "(32772)",
                "(65530)",
                "(65535)",
                "(65540)",
                "(8388602)",
                "(8388607)",
                "(8388612)",
                "(16777210)",
                "(16777215)",
                "(16777220)",
                "(2147483642)",
                "(2147483647)",
                "(2147483652)",
                "(4294967290)",
                "(4294967295)",
                "(4294967300)",
                "(9223372036854775802)",
                "(9223372036854775807)"
//                ,
//                "(9223372036854775812)",
//                "(18446744073709551610)",
//                "(18446744073709551615)",
//                "('1844674407370955162')",
//                "('184467440737095516148')",
//                "('184467440737095516150')"
            }/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)"
//                , "(9223372036854775812)", "(18446744073709551610)",
//                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
//                "('184467440737095516150')"
            }/*rnqQuerySortValues*/
            )

            /* BIGINT UNSINGED */
            //# bigint unsigned: 0~18446744073709551615
            // rnqQuerySortValues should add (18446744073709551620),(184467440737095516148),(184467440737095516150)
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_ubigint",
                new String[] {"c1"}/*col*/,
                new String[] {"bigint unsigned default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(1)", "(18446744073709551615)", "(18446744073709551614)",
                    "('18446744073709551615')", "('184467440737095516150')",
                    "('-184467440737095516150')"}/*insertValues*/
                , new String[] {
                "(null)", "(0)", "(1)", "(18446744073709551615)", "(18446744073709551614)",
                "('18446744073709551615')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* INT */
            //# INT: -2147483648 to 2147483647
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_int",
                new String[] {"c1"}/*col*/,
                new String[] {"int default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(-2147483648)", "(2147483647)", "(-2147483647)", "(2147483646)",
                    "('-2147483648')", "('2147483647')", "('184467440737095516150')",
                    "('-184467440737095516150')"}/*insertValues*/
                , new String[] {
                "(null)", "(0)", "(-2147483648)", "(2147483647)", "(-2147483647)", "(2147483646)", "('-2147483648')",
                "('2147483647')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/

            )

            /* INT UNSIGNED */
            //# INT UNSIGNED: 0 to 4294967295
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_uint",
                new String[] {"c1"}/*col*/,
                new String[] {"int unsigned default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(4294967295)", "(2147483647)", "(2147483646)", "('4294967295')", "('2147483647')",
                    "('184467440737095516150')", "('-184467440737095516150')"}/*insertValues*/
                , new String[] {
                "(null)", "(0)", "(4294967295)", "(2147483647)", "(2147483646)", "('4294967295')",
                "('2147483647')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* MEDIUMINT */
            //# MEDIUMINT: -8388608 to 8388607
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_mediumint",
                new String[] {"c1"}/*col*/,
                new String[] {"mediumint default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,

//                new String[] {
//                    "(null)", "(0)", "(-8388608)", "(8388607)", "(-8388607)", "(8388606)", "('-8388608')",
//                    "('8388607')", "('184467440737095516150')", "('-184467440737095516150')"}/*insertValues*/,
//                new String[] {
//                    "(null)", "(0)", "(-8388608)", "(8388607)", "(-8388607)", "(8388606)", "('-8388608')",
//                    "('8388607')"}/*selectValues*/

                new String[] {
                    "(null)", "(0)", "(-8388608)", "(8388607)", "(-8388607)", "(8388606)", "('-8388608')",
                    "('8388607')", "('184467440737095516150')", "('-184467440737095516150')",
                    "(null)",
                    "('-184467440737095516150')",
                    "('-184467440737095516148')",
                    "('-9223372036854775813')",
                    "(-9223372036854775808)",
                    "(-9223372036854775803)",
                    "(-2147483653)",
                    "(-2147483648)",
                    "(-2147483643)",
                    "(-8388613)",
                    "(-8388608)",
                    "(-8388603)",
                    "(-32773)",
                    "(-32768)",
                    "(-32763)",
                    "(-133)",
                    "(-128)",
                    "(-123)",
                    "(-5)",
                    "(0)",
                    "(5)",
                    "(122)",
                    "(127)",
                    "(132)",
                    "(255)",
                    "(32762)",
                    "(32767)",
                    "(32772)",
                    "(65530)",
                    "(65535)",
                    "(65540)",
                    "(8388602)",
                    "(8388607)",
                    "(8388612)",
                    "(16777210)",
                    "(16777215)",
                    "(16777220)",
                    "(2147483642)",
                    "(2147483647)",
                    "(2147483652)",
                    "(4294967290)",
                    "(4294967295)",
                    "(4294967300)",
                    "(9223372036854775802)",
                    "(9223372036854775807)",
                    "(9223372036854775812)",
                    "(18446744073709551610)",
                    "(18446744073709551615)",
                    "('1844674407370955162')",
                    "('184467440737095516148')",
                    "('184467440737095516150')"
                }/*insertValues*/,
                new String[] {
                    "(null)", "(0)", "(-8388608)", "(8388607)", "(-8388607)", "(8388606)", "('-8388608')",
                    "('8388607')",
                    "(null)",
                    "('-184467440737095516150')",
                    "('-184467440737095516148')",
                    "('-9223372036854775813')",
                    "(-9223372036854775808)",
                    "(-9223372036854775803)",
                    "(-2147483653)",
                    "(-2147483648)",
                    "(-2147483643)",
                    "(-8388613)",
                    "(-8388608)",
                    "(-8388603)",
                    "(-32773)",
                    "(-32768)",
                    "(-32763)",
                    "(-133)",
                    "(-128)",
                    "(-123)",
                    "(-5)",
                    "(0)",
                    "(5)",
                    "(122)",
                    "(127)",
                    "(132)",
                    "(255)",
                    "(32762)",
                    "(32767)",
                    "(32772)",
                    "(65530)",
                    "(65535)",
                    "(65540)",
                    "(8388602)",
                    "(8388607)",
                    "(8388612)",
                    "(16777210)",
                    "(16777215)",
                    "(16777220)",
                    "(2147483642)",
                    "(2147483647)",
                    "(2147483652)",
                    "(4294967290)",
                    "(4294967295)",
                    "(4294967300)",
                    "(9223372036854775802)",
                    "(9223372036854775807)",
                    "(9223372036854775812)",
                    "(18446744073709551610)",
                    "(18446744073709551615)",
                    "('18446744073709551620')",
                    "('184467440737095516148')",
                    "('184467440737095516150')"
                }/*selectValues*/

                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* MEDIUMINT UNSIGNED*/
            //# MEDIUMINT UNSIGNED: 0 to 16777215
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_umediumint",
                new String[] {"c1"}/*col*/,
                new String[] {"mediumint unsigned default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(16777215)", "(8388606)",
                    "('8388607')", "('184467440737095516150')", "('-184467440737095516150')"}/*insertValues*/,
                new String[] {
                    "(null)", "(0)", "(16777215)", "(8388606)",
                    "('8388607')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* SMALLINT */
            //# SMALLINT: -32768 to 32767
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_smallint",
                new String[] {"c1"}/*col*/,
                new String[] {"smallint default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(-32768)", "(32767)", "(-32767)", "(32766)", "('-32768')",
                    "('32767')", "('184467440737095516150')", "('-184467440737095516150')"}/*insertValues*/,
                new String[] {
                    "(null)", "(0)", "(-32768)", "(32767)", "(-32767)", "(32766)", "('-32768')",
                    "('32767')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* SMALLINT UNSIGNED */
            //# SMALLINT UNSIGNED: 0 to 65535
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_usmallint",
                new String[] {"c1"}/*col*/,
                new String[] {"smallint unsigned default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(65535)", "(1)", "(65534)", "('65535')", "('184467440737095516150')",
                    "('-184467440737095516150')"}/*insertValues*/,
                new String[] {
                    "(null)", "(0)", "(65535)", "(1)", "(65534)", "('65535')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* TINYINT */
            //# TINYINT: -128 to 127
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_tinyint",
                new String[] {"c1"}/*col*/,
                new String[] {"tinyint default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(-128)", "(127)", "('184467440737095516150')",
                    "('-184467440737095516150')"}/*insertValues*/,
                new String[] {
                    "(null)", "(0)", "(-128)", "(127)"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )

            /* TINYINT */
            //# TINYINT: 0 to 255
            , new PartitionColumnTypeTestBase.TestParameter(
                "key_utinyint",
                new String[] {"c1"}/*col*/,
                new String[] {"tinyint unsigned default null"}/*data types*/,
                new String[] {"set sql_mode='';set names utf8;", "", ""}/*prepStmts*/,
                "key"/*strategy*/,
                new String[] {"16"}/*bndVal*/,
                new String[] {
                    "(null)", "(0)", "(255)", "('255')", "('184467440737095516150')",
                    "('-184467440737095516150')"}/*insertValues*/,
                new String[] {
                    "(null)", "(0)", "(255)", "('255')"}/*selectValues*/
                , new String[] {
                "(-184467440737095516150)", "(-184467440737095516148)", "(-9223372036854775813)",
                "(-9223372036854775808)", "(-9223372036854775803)", "(-2147483653)", "(-2147483648)", "(-2147483643)",
                "(-8388613)", "(-8388608)", "(-8388603)", "(-32773)", "(-32768)", "(-32763)", "(-133)", "(-128)",
                "(-123)", "(-5)", "(0)", "(5)", "(122)", "(127)", "(132)", "(32762)", "(32767)", "(32772)", "(65530)",
                "(65535)", "(65540)", "(8388602)", "(8388607)", "(8388612)", "(16777210)", "(16777215)", "(16777220)",
                "(2147483642)", "(2147483647)", "(2147483652)", "(4294967290)", "(4294967295)", "(4294967300)",
                "(9223372036854775802)", "(9223372036854775807)", "(9223372036854775812)", "(18446744073709551610)",
                "(18446744073709551615)", "('18446744073709551620')", "('184467440737095516148')",
                "('184467440737095516150')"}/*rnqQuerySortValues*/
            )
        );
    }

    @Test
    public void runTest() throws SQLException {
        super.testInsertAndSelect();
    }

}
